// 规定一个项目最多只能有一个store

import { configureStore } from "@reduxjs/toolkit"
// import chat from "./reducers/chat"

import rootReducer from "./reducers/rootReducer"

//redux有哪些中间件? 中间件有logger thunk(解决方案) redux-promise  redux-saga

//中间件是有顺序的 顺序按照文档指示来

import * as api from "../api"

import logger from "redux-logger"

const rootStore = configureStore({
    reducer: rootReducer,
    //中间件
    // middleware: [logger]
    middleware: function (getDefaultMiddleware) {
        return getDefaultMiddleware({
            thunk: {
                //拓展的参数,这里一般填写 请求的对象
                extraArgument: api
            },
            
        })
    }
    // reducer: chat
})


export default rootStore